#define  _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    string minWindow(string s, string t) {
        if (s.size() < t.size()) return "";
        int count = 0, tgt_count = 0, b, ret_size = 0;
        long long hashs[256] = { 0 };
        long long hasht[256] = { 0 };
        for (auto e : t) if (hasht[e]++ == 0) tgt_count++;
        for (int left = 0, right = 0; right < s.size(); right++)
        {
            int hashi_right = s[right];
            if (++hashs[hashi_right] == hasht[hashi_right]) count++;
            while (count == tgt_count)
            {
                if (ret_size == 0 || right - left + 1 < ret_size)b = left, ret_size = right - left + 1;
                int hashi_left = s[left++];
                if (hashs[hashi_left]-- == hasht[hashi_left])count--;
            }
        }
        return s.substr(b, ret_size);
    }
};